//
//  WWBaseViewController.swift
//  SinWEiBo
//
//  Created by 胡良志 on 2018/3/15.
//  Copyright © 2018年 HuLiangZhi. All rights reserved.
//

import UIKit

class WWBaseViewController: UITableViewController {
    
    
    //MARK: 定义属性用户是否登陆
    var userLogin : Bool = WWUserAccountViewModel.shared.userLogin
    //初始化WWVisitorView对象
    lazy var visitor:WWVisitorView = WWVisitorView()
    
    override func loadView() {
        if userLogin {
            super.loadView()
            //已登录
        }else{
            //未登录
            self.view = visitor
            visitor.delegate = self
        }
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }


}
//MARK: WWVisitorViewDelegate
extension WWBaseViewController : WWVisitorViewDelegate{
    func userWillLogin(){
        let oauth = WWOAuthViewController()
        //给oauth一个导航控制器
        let nav = UINavigationController(rootViewController: oauth)
        self.present(nav, animated: true)
    }
    func userWillRegister (){
        print("ppp")
    }
}



